{
	template:`
    <m-page @back="back" :title="title">
		<m-card>
			<div class="padding-sm">
				<div v-for="(item,key) in typeList" :key="key" class="padding-xs cu-capsule radius" style="margin:0;">
					<div @click="queryTypeList(item.oid)" class='cu-tag light' :class="['bg-'+item.color]">{{item.name}}{{params['type.oid@eq']==item.oid?'√':''}}</div>
				</div>
			</div>
		</m-card>
        <m-title>{{title}}</m-title>
		<m-top></m-top>
		<m-list ref="list" :url="url" :params="params" :bottom="0" :search="search">
			<template #item="{item}">
				<m-card join>
					<div class="flex padding-sm align-center">
                        <div class="cu-tag radius" :class="'bg-'+item.type.color">{{item.type.name}}</div>
                        <div class="flex-sub padding-lr-sm">
                            <div>
                                <div v-if="item.store.oid" class="cu-tag radius sm" :class="'bg-'+item.store.color">{{item.store.name}}</div>
                                <div v-else class="cu-tag radius sm bg-blue">店铺通用</div>
                                {{item.title}}
                            </div>
                            <div class="text-sm text-gray">
                                原价{{formatAmount(item.price)}}元
                                <span v-if="item.discount" class="padding-bottom-xs text-blue">优惠{{item.discount}}%</span>
                            </div>
                        </div>
                        <div class="text-right text-sm">
                            <span class="text-lg text-red">{{formatAmount(item.price-item.price*(item.discount||0)/100)}}</span>元
                        </div>
					</div>
                    <div v-if="item.description" class="padding-sm solid-top text-sm">
                        {{item.description}}
                    </div>
				</m-card>
			</template>
		</m-list>
    </m-page>
	`,
	props: ['param','parentVue'],
	data:function(){
		return {
		    edit:false,
		    store:{},
            title:'店铺服务商品',
            url:'action/member/serveGoods/getAllList',
            params:{'type.oid@eq':''},
            search:[
                {title:'标题',name:'title@like',input:'text'}
            ],
            showDetail:null,
            typeList:[]
		};
	},
	mounted(){
        this.store=config.store;
	    this.loadTypeList();
	},
	methods:{
        queryTypeList:function(typeOid){
            if(this.params['type.oid@eq']==typeOid){
                this.params['type.oid@eq']="";
            }else{
                this.params['type.oid@eq']=typeOid;
            }
            this.$refs.list.refresh(1);
        },
        loadTypeList:function(){
            this.requestData('action/member/serveGoods/serveType',
                {},
                (data)=>{
                    if(data.code==0){
                        this.typeList=data.list;
                    }else{
                        this.remind().error(data.msg);
                    }
                }
            );
        }
	}
}